import time
import os.path
from activist.Config import Config
from twisted.internet import reactor

if not os.path.isdir(os.path.join(Config.base,'data/commands.log')):
    os.system( 'mkdir %s'%os.path.join(Config.base,'data/commands.log') )

from activist.DataStore import DataStore
from activist.Person import Person
from activist.Group import Group
from activist.Place import Place
from activist.Event import Event
from activist.Alias import Alias
from activist.Comment import Comment
from activist.GenericData import GenericData
from activist.EventInformation import EventInformation
from activist.MetaData import MetaDataFactory, MetaData
from activist.CommandProcessor import CommandProcessor
import activist.Place
import activist.Person
import activist.Event
import activist.Time
import activist.Category


CommandProcessor.initialize()


highlight = DataStore['highlighted events']
moderated = DataStore['moderated']
administrator = DataStore['administrator']

commands = []


personA = activist.Person.Person()
personA.create('mike warren', 'fred', 'flintstone', '123-4567', 'foo@bar.com', None, "some sort of bio", False)
personA.make_administrator(personA,True)
personA.make_moderator(personA,True)

placeA = activist.Place.Place()
placeA.create('Place A', '456 Foo Bar Avenue', ['555-1234','555-4321'], ['smoking'], 'calgary.ab.ca','',None)

placeB = activist.Place.Place()
placeB.create('Place B', '#1 1492 64th Street NW\nCalgary, Alberta', ['555-1234','555-4321'], [], 'edmonton.ab.ca','just a tiny note',None)

eventA = activist.Event.Event()
eventA.create(personA, 'Event A', activist.Time.now(3600), ['signlanguage'], 'Some random event, happening right now!', 'Smaller description.', placeA, 'other')
eventA.approve(personA)
eventA.category(DataStore.getCategories()[0])

if 1:
    groupA = activist.Group.Group()
    groupA.create("some group","no description","http://example.com",[],[],[],[],None)
    groupA.event(eventA)
    groupA.person(personA)

eventB = activist.Event.Event()
eventB.create(personA, 'Event B', activist.Time.TimeRange(time.time()-86400.0,3.5*3600), ['childcare'], 'Event description (should be from yesterday)', 'Yesterday event.', placeB, 'other')

eventB.approve(personA)

place = activist.Place.Place()
place.create("test place", "test place's address", ["(403) 555-1234"], [], 'edmonton.ab.ca',None,None)
person = activist.Person.Person()
person.create( "test person", "testperson", None, ["(403) 555-4321"], ["test@person.com"], "test person's address", "a brief bio", True )
#when = activist.Time.now(3600)
when = activist.Time.Repeating(time.time(), 3600, activist.Time.RepeatGenerateWeekly("second","wednesday"))

eventC = activist.Event.Event()
eventC.create( person, 'Event C', when, [], r"""
Come and create testing events for the new activist nework code. Mike
will be on hand to provide motivation and discipline.

If you think this might be fun, bring a friend, some patience and
your computer.

testing rST:

This is a paragraph.  It's quite
short.

   This paragraph will result in an indented block of
   text, typically used for quoting other text.

This is another one. I have some *highlightted* and **strongly
highlighted** text in here, too. What fun! What does a URL look like? 
http://www.mike-warren.com

How about if I want `a link with a name`_ to the same place?

.. _a link with a name: http://www.mike-warren.com

* a bullet point using "*"

  - a sub-list using "-"

      + yet another sub-list

        - another item

Let's try an example::

   this is an example with some * of the *weirdo*
   formatting \and \stuff{} which rST uses.

        whoa!

example over.

I Am A Title
------------

I'm a paragraph below the above title.

                     """, 'Brief version of description.', place, 'other')
